<template>
	<view class="records">
		<view class="balance_details">
			<view class="date">
				<view class="date_content">
					<view class="text"><text>05</text>月<text>2023年</text></view>
					<view @click="sequence=!sequence">
						<image src="@/static/down@1.png" v-if="sequence"></image>
						<image src="../../static/top@1.png" v-else></image>
					</view>
				</view>
			</view>
			<view class="content_box">
				<view 
				class="item"
				v-for="item, index in newTablelist"
				:key="index"
				>
					<view class="left">
						<!-- <text>XXX充值</text> -->
						<text>{{getUpdateTime(item.createtime)}}</text>
					</view>
					<view class="right">￥{{item.acc_bal}}</view>
				</view>
				
				<!-- <view class="item">
					<view class="left">
						<text>XXX充值</text>
						<text>2022-08-20 11:20:30</text>
					</view>
					<view class="right">+￥30</view>
				</view>
				<view class="item">
					<view class="left">
						<text>XXX充值</text>
						<text>2022-08-20 11:20:30</text>
					</view>
					<view class="right">+￥30</view>
				</view> -->
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				newTablelist:[],
				sequence:false
			}
		},
		onShow() {
			this.tableList()
		},
		methods: {
			
			getUpdateTime(time) {
			    let date = new Date(time*1000)
			    let Y = date.getFullYear() + '-'
			    let M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-'
			    let D = (date.getDate() < 10 ? '0' + date.getDate() : date.getDate()) + ' '
			    let h = (date.getHours() < 10 ? '0' + date.getHours() : date.getHours()) + ':'
			    let m = (date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()) + ':'
			    let s = (date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds())
			    return Y + M + D + h + m + s
					},
			tableList() {
				this.$http({
					url:'api/Wechat/cardRechargeLog',
				}).then(res => {
					console.log(res,'....00')
					this.$nextTick(() => {
						this.newTablelist = res.data
					})
					
					this.newTablelist.forEach(res => {
						console.log(res,'...11');
					})
				}).catch(err => {
					
				})
			}
		}
	}
</script>

<style lang="scss">
.records {
	.balance_details {
		width: 690rpx;
		margin: 40rpx 30rpx 0 30rpx;
	
		.title {
			width: 100%;
			display: flex;
			justify-content: space-between;
			align-items: center;
			font-size: 30rpx;
			font-family: Source Han Sans CN-Medium, Source Han Sans CN;
			font-weight: 500;
			color: #222222;
			line-height: 1em;
	
			text:last-child {
				font-size: 28rpx;
				font-family: Source Han Sans CN-Medium, Source Han Sans CN;
				font-weight: 400;
				color: #222222;
			}
		}
	
		.date {
			width: 100%;
			display: flex;
			justify-content: space-between;
			align-items: center;
			margin-top: 28rpx;
	
			.date_content {
				font-size: 26rpx;
				font-family: Source Han Sans CN-Medium, Source Han Sans CN;
				font-weight: 500;
				color: #222222;
				display: flex;
				align-items: center;
	
				.text {
					text:first-child {
						font-size: 36rpx;
						line-height: 1em;
					}
	
					text:last-child {
						margin-left: 6rpx
					}
				}
	
				image {
					width: 18rpx;
					height: 14rpx;
					margin-left: 14rpx;
				}
			}
	
			view:last-child {
				font-size: 28rpx;
				font-family: Source Han Sans CN-Medium, Source Han Sans CN;
				font-weight: 400;
				color: #222222;
			}
		}
	
		.content_box {
			width: 100%;
			padding: 0 24rpx;
			box-sizing: border-box;
			background-color: #FFFFFF;
			margin-top: 28rpx;
	
			.item:last-child {
				border: none;
			}
	
			.item {
				height: 158rpx;
				width: 100%;
				display: flex;
				justify-content: space-between;
				align-items: center;
	
				border-bottom: 1rpx solid #ECECEC;
	
				.left {
					display: flex;
					flex-direction: column;
					gap: 24rpx 0;
	
					text:first-child {
						font-size: 28rpx;
						font-family: Source Han Sans CN-Medium, Source Han Sans CN;
						font-weight: 500;
						color: #222222;
						line-height: 1em;
					}
	
					text:last-child {
						font-size: 26rpx;
						font-family: Source Han Sans CN-Regular, Source Han Sans CN;
						font-weight: 400;
						color: #555555;
						line-height: 1em;
					}
				}
	
				.right {
					font-size: 36rpx;
					font-family: Source Han Sans CN-Medium, Source Han Sans CN;
					font-weight: 500;
					color: #222222;
					line-height: 1em;
				}
			}
		}
	}
}
</style>
